﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
using Tracy.Plugins.DownloadAdapters.Model;
using System.Xml;

namespace Tracy.Plugins.DownloadAdapters.ServiceDefinition
{
    [ServiceContract]
    public interface IUTorrentWebAPI
    {
        [OperationContract]
        [WebGet(
            BodyStyle = WebMessageBodyStyle.Bare,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/?action=getsettings&token={token}"
            )]
        UTorrentSettings GetSettings(string token);

        [OperationContract]
        [WebGet(
            BodyStyle = WebMessageBodyStyle.Bare,
            ResponseFormat = WebMessageFormat.Xml,
            UriTemplate = "/token.html"
            )]
        UTorrentToken GetToken();

        [OperationContract]
        [WebGet(
            BodyStyle = WebMessageBodyStyle.Bare,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/?action=add-url&s={url}&token={token}"
            )]
        UTorrentResponse AddUrl(string url, string token);

        [OperationContract]
        [WebGet(
            BodyStyle = WebMessageBodyStyle.Bare,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/?action=setsetting&s={name}&v={value}&token={token}"
            )]
        UTorrentResponse SetSetting(string name, string value, string token);
    }
}
